<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>操作元素的类名</title>
    <style>
        .item{
            width: 100px;
            height: 100px;
            background: yellow;
            color: red;
            border-radius: 10px;
        }
        .item1{
            width: 200px;
            height: 200px;
            background: red;
            color: yellow;
        }
    </style>
</head>
<body>
    <div id="box" class="item">陈志攀</div>
    <script>
        box.onclick = function(){
             //有该值是删除 没有是新增
            box.classList.toggle('item')
        }
        box.className = 'item1'
        console.log(box.classList)
        box.classList.add('item', 'item1', 'item1')
        console.log(box.classList)
        box.classList.remove('item')
    </script>
</body>
</html>